package ua.simplecoding.kievhome.domain {

import mx.collections.ArrayCollection;

public class AppartmentModel {
    [Bindable]
    [Publish(objectId="appartmentSummaryList")]
    public var appartmentSummaryList:ArrayCollection = new ArrayCollection();

//    [Bindable]
//    [PublishSubscribe(objectId="currentTodoItem")]
//    public var currentTodoItem:AppartmentSummaryVO;

//    private var _savedCurrentTodoItem:Object;

//    public function backupCurrentTodoItem():void {
//        _savedCurrentTodoItem = ObjectUtil.copy(currentTodoItem);
//    }

//    public function get savedCurentTodoItem():Object {
//        return _savedCurrentTodoItem;
//    }

//    public function rollbackCurrentTodoItem():void {
//        if (!_savedCurrentTodoItem) {
//            return;
//        }
//
//        if (currentTodoItem.isNew()) {
//            appartmentSummaryList.removeItemAt(appartmentSummaryList.getItemIndex(currentTodoItem))
//
//            currentTodoItem = null;
//        }
//        else {
//            if (savedCurentTodoItem) {
//                currentTodoItem.title = _savedCurrentTodoItem.title;
//            }
//        }
//    }

//    public function deleteItem(todo:AppartmentSummaryVO):void {
//        if (appartmentSummaryList) {
//            appartmentSummaryList.removeItemAt(appartmentSummaryList.getItemIndex(todo));
//        }
//    }

//    public function createNewTodoItem():AppartmentSummaryVO {
//        var newItem:AppartmentSummaryVO;
//
//        if (appartmentSummaryList) {
//            newItem = new AppartmentSummaryVO();
//            appartmentSummaryList.addItem(newItem);
//        }
//
//        return newItem;
//    }
}
}